(* ListDl.pp*)

unit ListDl;

interface

uses nodes;

var
dummy : info;
DummyLink : link;

procedure DummyIns; 
procedure NodeIns(a : node); 

implementation

procedure DummyIns; 
begin
   dummy.inp := 0;
   dummy.NextTime := 0;
   dummy.out := 0; 
   new(DummyLink);
   DummyLink^.item := dummy;
   DummyLink^.next := DummyLink;
   DummyLink^.prev := DummyLink;
end;

procedure NodeIns(a : node); 
var
t,u : link;
begin
   new(t);
   if DummyLink^.prev = DummyLink then
begin
   t^.item := a.item;
   t^.prev := DummyLink;
   t^.next := DummyLink;
   DummyLink^.prev := t;
   DummyLink^.next := t;
end
    else 
begin
   t^.item := a.item;
   u := DummyLink^.prev;
   u^.next := t;
   DummyLink^.prev := t;
   t^.prev := u;
   t^.next := DummyLink;
end;
end;

end.
